package com.dnjn.happiness.emo.amqp;

import com.dnjn.happiness.common.amqp.AmqpConst;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author amber
 * @version 1.0
 * @description TODO
 * @date 2024/6/5 16:56
 **/
@Configuration
public class EmoAmqpConfig {

    @Bean
    public Queue happySendQueue() {
        return new Queue(AmqpConst.SCORE_RESULT_QUEUE_NAME, true);
    }

    @Bean
    public DirectExchange happySendDirectExchange() {
        return new DirectExchange(AmqpConst.SCORE_RESULT_EXCHANGE_NAME, true, false);
    }

    @Bean
    public Binding happySendBindingExchange() {
        return BindingBuilder.bind(happySendQueue()).to(happySendDirectExchange()).with(AmqpConst.SCORE_RESULT_ROUTING_KEY);
    }



}
